<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>群里底层玩家</title>
  </head>
  <body>
    <div id="progress"></div>
    <fieldset>
      <legend>
        <input id="upload" type="file" onchange="foo()" >
      </legend>
      <div id="show">no data.</div>
    </fieldset>
    <br/>
    <hr>
    <div id="root"></div>
    <!-- <button onclick="foo()">下载</button>
    <div id="res">结果</div>
    <script>
      function base64toFile(dataurl, filename = "file") {
        let arr = dataurl.split(",");
        let mime = "application/octet-stream";
        let suffix = mime.split("/")[1];
        let bstr = atob(arr[1]);
        let n = bstr.length;
        let u8arr = new Uint8Array(n);
        while (n--) {
          u8arr[n] = bstr.charCodeAt(n);
        }
        let file = new File([u8arr], `${filename}`, {
          type: mime,
        });
        console.log(file);
        return file;
      }
      function foo() {
        fetch("./wasm/onlywechart.base64")
          .then((v) => v.text())
          .then((v) => {
            let aTag = document.createElement("a"); //创建一个a标签
            aTag.download = "onlyWechartWasmBinaryFile";
            let href = URL.createObjectURL(base64toFile(v));
            aTag.href = href;
            aTag.click();
          });
      }
    </script> -->
  </body>
</html>
